.\"
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
.\" permission to reproduce portions of its copyrighted documentation.
.\" Original documentation from The Open Group can be obtained online at
.\" http://www.opengroup.org/bookstore/.
.\"
.\" The Institute of Electrical and Electronics Engineers and The Open
.\" Group, have given us permission to reprint portions of their
.\" documentation.
.\"
.\" In the following statement, the phrase ``this text'' refers to portions
.\" of the system documentation.
.\"
.\" Portions of this text are reprinted and reproduced in electronic form
.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
.\" Standard for Information Technology -- Portable Operating System
.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
.\" between these versions and the original IEEE and The Open Group
.\" Standard, the original IEEE and The Open Group Standard is the referee
.\" document.  The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
.\" This notice shall appear on any product containing this material.
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\"
.\" Copyright 1989 AT&T
.\" Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
.\" Portions Copyright (c) 1995, Sun Microsystems, Inc.  All Rights Reserved
.\"
.TH PR 1 "Mar 18, 1997"
.SH NAME
pr \- print files
.SH SYNOPSIS
.LP
.nf
\fB/usr/bin/pr\fR [+ \fIpage\fR] [\fB-column\fR] [\fB-adFmrt\fR] [\fB-e\fR [\fIchar\fR] [\fIgap\fR]]
     [\fB-h\fR \fIheader\fR] [\fB-i\fR [\fIchar\fR] [\fIgap\fR]] [\fB-l\fR \fIlines\fR]
     [\fB-n\fR [\fIchar\fR] [\fIwidth\fR]] [\fB-o\fR \fIoffset\fR] [\fB-s\fR [\fIchar\fR]]
     [\fB-w\fR \fIwidth\fR] [\fB-fp\fR] [\fIfile\fR]...
.fi

.LP
.nf
\fB/usr/xpg4/bin/pr\fR [+ \fIpage\fR] [\fB-column\fR | \fB-c\fR \fIcolumn\fR] [\fB-adFmrt\fR]
     [\fB-e\fR [\fIchar\fR] [\fIgap\fR]] [\fB-h\fR \fIheader\fR] [\fB-i\fR [\fIchar\fR] [\fIgap\fR]]
     [\fB-l\fR \fIlines\fR] [\fB-n\fR [\fIchar\fR] [\fIwidth\fR]] [\fB-o\fR \fIoffset\fR]
     [\fB-s\fR [\fIchar\fR]] [\fB-w\fR \fIwidth\fR] [\fB-fp\fR] [\fIfile\fR]...
.fi

.SH DESCRIPTION
.sp
.LP
The \fBpr\fR utility is a printing and pagination filter. If multiple input
files are specified, each is read, formatted, and written to standard output.
By default, the input is separated into 66-line pages, each with:
.RS +4
.TP
.ie t \(bu
.el o
a 5-line header that includes the page number, date, time and the path name of
the file
.RE
.RS +4
.TP
.ie t \(bu
.el o
a 5-line trailer consisting of blank lines
.RE
.sp
.LP
If standard output is associated with a terminal, diagnostic messages will be
deferred until the \fBpr\fR utility has completed processing.
.sp
.LP
When options specifying multi-column output are specified, output text columns
will be of equal width; input lines that do not fit into a text column will be
truncated. By default, text columns are separated with at least one blank
character.
.SH OPTIONS
.sp
.LP
The following options are supported. In the following option descriptions,
\fIcolumn\fR, \fIlines\fR, \fIoffset\fR, \fIpage\fR, and \fIwidth\fR are
positive decimal integers; \fIgap\fR is a non-negative decimal integer. Some of
the option-arguments are optional, and some of the option-arguments cannot be
specified as separate arguments from the preceding option letter. In
particular, the \fB-s\fR option does not allow the option letter to be
separated from its argument, and the options \fB-e\fR, \fB-i\fR, and \fB-n\fR
require that both arguments, if present, not be separated from the option
letter.
.sp
.LP
The following options are supported for both \fB/usr/bin/pr\fR and
\fB/usr/xpg4/bin/pr\fR:
.sp
.ne 2
.na
\fB\fB+\fR\fIpage\fR\fR
.ad
.RS 29n
Begins output at page number \fIpage\fR of the formatted input.
.RE

.sp
.ne 2
.na
\fB\fB-\fR\fIcolumn\fR\fR
.ad
.RS 29n
Produces multi-column output that is arranged in \fIcolumn\fR columns (default
is \fB1\fR) and is written down each column in the order in which the text is
received from the input file. This option should not be used with \fB-m\fR. The
\fB-e\fR and \fB-i\fR options will be assumed for multiple text-column output.
Whether or not text columns are produced with identical vertical lengths is
unspecified, but a text column will never exceed the length of the page (see
the \fB-l\fR option). When used with \fB-t\fR, use the minimum number of lines
to write the output.
.RE

.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 29n
Modifies the effect of the \fB-\fR\fIcolumn\fR option so that the columns are
filled across the page in a round-robin order (for example, when \fIcolumn\fR
is 2, the first input line heads column 1, the second heads column 2, the third
is the second line in column 1, and so forth).
.RE

.sp
.ne 2
.na
\fB\fB-d\fR\fR
.ad
.RS 29n
Produces output that is double-spaced; append an extra \fBNEWLINE\fR character
following every \fBNEWLINE\fR character found in the input.
.RE

.sp
.ne 2
.na
\fB\fB\fR\fB-e\fR\fB\|[\|\fR\fIchar\fR\fB\|][\|\fR\fIgap\fR\fB\|]\fR\fR
.ad
.RS 29n
Expands each input \fBTAB\fR character to the next greater column position
specified by the formula \fIn\fR \fI*gap+1\fR, where \fIn\fR is an integer
\fB>0\fR. If \fIgap\fR is \fB0\fR or is omitted, it defaults to \fB8\fR. All
\fBTAB\fR characters in the input will be expanded into the appropriate number
of \fBSPACE\fR characters.  If any non-digit character, \fIchar\fR, is
specified, it will be used as the input tab character.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 29n
Uses a \fBFORMFEED\fR character for new pages, instead of the default behavior
that uses a sequence of \fBNEWLINE\fR characters. Pauses before beginning the
first page if the standard output is associated with a terminal.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR \fIheader\fR\fR
.ad
.RS 29n
Uses the string \fIheader\fR to replace the contents of the \fIfile\fR operand
in the page header.
.RE

.sp
.ne 2
.na
\fB\fB-l\fR \fIlines\fR\fR
.ad
.RS 29n
Overrides the 66-line default and reset the page length to \fIlines\fR. If
\fIlines\fR is not greater than the sum of both the header and trailer depths
(in lines), \fBpr\fR will suppress both the header and trailer, as if the
\fB-t\fR option were in effect.
.RE

.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 29n
Merges files. Standard output will be formatted so \fBpr\fR writes one line
from each file specified by \fIfile\fR, side by side into text columns of equal
fixed widths, in terms of the number of column positions. Implementations
support merging of at least nine \fIfile\fRs.
.RE

.sp
.ne 2
.na
\fB\fB-n\|[\|\fR\fIchar\fR\fB\|][\|\fR\fIwidth\fR\fB\|]\fR\fR
.ad
.RS 29n
Provides \fIwidth\fR-digit line numbering (default for \fIwidth\fR is \fB5\fR).
The number will occupy the first \fIwidth\fR column positions of each text
column of default output or each line of \fB-m\fR output. If \fIchar\fR (any
non-digit character) is given, it will be appended to the line number to
separate it from whatever follows (default for \fIchar\fR is a \fBTAB\fR
character).
.RE

.sp
.ne 2
.na
\fB\fB-o\fR \fIoffset\fR\fR
.ad
.RS 29n
Each line of output will be preceded by offset <space>s. If the \fB-o\fR option
is not specified, the default offset is \fB0\fR. The space taken will be in
addition to the output line width (see \fB-w\fR option below).
.RE

.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 29n
Pauses before beginning each page if the standard output is directed to a
terminal (\fBpr\fR will write an \fBALERT\fR character to standard error and
wait for a carriage-return character to be read on \fB/dev/tty\fR).
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.RS 29n
Writes no diagnostic reports on failure to open files.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR \fB[\fR\fIchar\fR\fB]\fR\fR
.ad
.RS 29n
Separates text columns by the single character \fIchar\fR instead of by the
appropriate number of \fBSPACE\fR characters (default for \fIchar\fR is the
\fBTAB\fR character).
.RE

.sp
.ne 2
.na
\fB\fB-t\fR\fR
.ad
.RS 29n
Writes neither the five-line identifying header nor the five-line trailer
usually supplied for each page. Quits writing after the last line of each file
without spacing to the end of the page.
.RE

.sp
.ne 2
.na
\fB\fB-w\fR \fIwidth\fR\fR
.ad
.RS 29n
Sets the width of the line to \fIwidth\fR column positions for multiple
text-column output only. If the \fB-w\fR option is not specified and the
\fB-s\fR option is not specified, the default width is \fB72\fR. If the
\fB-w\fR option is not specified and the \fB-s\fR option is specified, the
default width is \fB512\fR.
.sp
For single column output, input lines will not be truncated.
.RE

.SS "/usr/bin/pr"
.sp
.LP
The following options are supported for \fB/usr/bin/pr\fR only:
.sp
.ne 2
.na
\fB\fB-F\fR\fR
.ad
.RS 27n
Folds the lines of the input file. When used in multi-column mode (with the
\fB-a\fR or \fB-m\fR options), lines will be folded to fit the current column's
width. Otherwise, they will be folded to fit the current line width (80
columns).
.RE

.sp
.ne 2
.na
\fB\fB\fR\fB-i\fR\fB\|[\|\fR\fIchar\fR\fB\|][\|\fR\fIgap\fR\fB\|]\fR\fR
.ad
.RS 27n
In output, replaces \fBSPACE\fR characters with \fBTAB\fR characters wherever
one or more adjacent \fBSPACE\fR characters reach column positions \fIgap+1\fR,
\fI2*gap+1\fR, \fI3*gap+1\fR, and so forth. If \fIgap\fR is \fB0\fR or is
omitted, default \fBTAB\fR settings at every eighth column position are
assumed. If any non-digit character, \fIchar\fR, is specified, it will be used
as the output \fBTAB\fR character.
.RE

.SS "/usr/xpg4/bin/pr"
.sp
.LP
The following options are supported for \fB/usr/xpg4/bin/pr\fR only:
.sp
.ne 2
.na
\fB\fB-F\fR\fR
.ad
.RS 27n
Uses a \fBFORMFEED\fR character for new pages, instead of the default behavior
that uses a sequence of \fBNEWLINE\fR characters.
.RE

.sp
.ne 2
.na
\fB\fB\fR\fB-i\fR\fB\|[\|\fR\fIchar\fR\fB\|][\|\fR\fIgap\fR\fB\|]\fR\fR
.ad
.RS 27n
In output, replaces multiple \fBSPACE\fR characters with \fBTAB\fR characters
wherever two or more adjacent \fBSPACE\fR characters reach column positions
\fIgap+1\fR, \fI2*gap+1\fR, \fI3*gap+1\fR, and so forth. If \fIgap\fR is
\fB0\fR or is omitted, default \fBTAB\fR settings at every eighth column
position are assumed. If any non-digit character, \fIchar\fR, is specified, it
will be used as the output \fBTAB\fR character.
.RE

.SH OPERANDS
.sp
.LP
The following operand is supported:
.sp
.ne 2
.na
\fB\fIfile\fR\fR
.ad
.RS 8n
A path name of a file to be written. If no \fIfile\fR operands are specified,
or if a \fIfile\fR operand is \fB\(mi\fR, the standard input will be used.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRPrinting a numbered list of all files in the current directory
.sp
.in +2
.nf
example% \fBls -a | pr -n -h "Files in $(pwd)."\fR
.fi
.in -2
.sp

.LP
\fBExample 2 \fRPrinting files in columns
.sp
.LP
This example prints \fBfile1\fR and \fBfile2\fR as a double-spaced,
three-column listing headed by \fBfile list\fR:

.sp
.in +2
.nf
example% \fBpr -3d -h "file list" file1 file2\fR
.fi
.in -2
.sp

.LP
\fBExample 3 \fRWriting files with expanded column tabs
.sp
.LP
The following example writes \fBfile1\fR on \fBfile2\fR, expanding tabs to
columns \fB10\fR, \fB19\fR, \fB28\fR, ...

.sp
.in +2
.nf
example% \fBpr -e9 -t <file1 >file2\fR
.fi
.in -2
.sp

.SH ENVIRONMENT VARIABLES
.sp
.LP
See \fBenviron\fR(7) for descriptions of the following environment variables
that affect the execution of \fBpr\fR: \fBLANG\fR, \fBLC_ALL\fR,
\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_TIME\fR, \fBTZ\fR, and \fBNLSPATH\fR.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 6n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
An error occurred.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.SS "/usr/bin/pr"
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	Enabled
.TE

.SS "/usr/xpg4/bin/pr"
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	Enabled
_
Interface Stability	Committed
_
Standard	See \fBstandards\fR(7).
.TE

.SH SEE ALSO
.sp
.LP
.BR expand (1),
.BR lp (1),
.BR attributes (7),
.BR environ (7),
.BR standards (7)
